class Article < ActiveRecord::Base
  paginates_per 10

  has_one :document, :as => :source, :dependent => :destroy

  default_scope order('created_at DESC')

  after_initialize lambda { |a| a.build_document }, :unless => :document

  accepts_nested_attributes_for :document

  validates_presence_of :document

  # TODO move common functionality to module
end
